﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

using WPF_Dialogs.Custom_Controls;

namespace WPF_Dialogs.Dialogs
{
    /// <summary>
    /// Interaction logic for SaveDialog.xaml
    /// </summary>
    public partial class SaveDialog : Window, IDialog
    {
        /// <summary>
        /// Gets or sets the dialog result value, which is the value that is returned from the <see cref="M:System.Windows.Window.ShowDialog"/> method.
        /// </summary>
        /// <value></value>
        /// <returns>A <see cref="T:System.Nullable`1"/> value of type <see cref="T:System.Boolean"/>. The default is false.</returns>
        /// <exception cref="T:System.InvalidOperationException">
        /// 	<see cref="P:System.Windows.Window.DialogResult"/> is set before a window is opened by calling <see cref="M:System.Windows.Window.ShowDialog"/>, or a window opened by calling <see cref="M:System.Windows.Window.Show"/>.</exception>
        public new EDialogResult DialogResult { set; get; }

        public SaveDialog()
        {
            InitializeComponent();
        }

        #region private functions
        private new bool? ShowDialog()
        {
            return base.ShowDialog();
        }

        private void button_Clicked(object sender, RoutedEventArgs e)
        {
            DialogButton s = e.OriginalSource as DialogButton;
            this.DialogResult = s.DialogResult;
            this.Close();
            e.Handled = true;
        }
        #endregion

        #region public functions
        /// <summary>
        /// Shows the dialog.
        /// </summary>
        /// <returns>The result of the dialog</returns>
        public EDialogResult showDialog()
        {
            this.ShowDialog();
            return this.DialogResult;
        }
        #endregion

        #region public properties
        /// <summary>
        /// Sets the content of the button yes.
        /// </summary>
        /// <value>The content of the button yes.</value>
        public object ButtonYesContent
        {
            set
            {
                this.buttonYes.Content = value;
            }
        }

        /// <summary>
        /// Sets the content of the button no.
        /// </summary>
        /// <value>The content of the button no.</value>
        public object ButtonNoContent
        {
            set
            {
                this.buttonNo.Content = value;
            }
        }

        /// <summary>
        /// Sets the content of the button cancel.
        /// </summary>
        /// <value>The content of the button cancel.</value>
        public object ButtonCancelContent
        {
            set
            {
                this.buttonCancel.Content = value;
            }
        }

        /// <summary>
        /// Sets the content of the label text.
        /// </summary>
        /// <value>The content of the label text.</value>
        public object LabelTextContent
        {
            set
            {
                this.labelText.Content = value;
            }
        }
        #endregion
    }
}
